Skip to main content

Basic traversals

  1. Here is an example of getting all the unique routes sorted by distance

    for v, e, p IN 1..1  inbound "airports/SFO" flights
    sort e.Distance desc, e._from, e.UniqeCarrier
    let route={
    _from: e._from,
    _to: e._to,
    UniqueCarrier: e.UniqueCarrier,
    Distance: e.Distance
    }
    return distinct route
  2. Here is a snippet of the response:

    [
    {
    "_from": "airports/BOS",
    "_to": "airports/SFO",
    "UniqueCarrier": "UA",
    "Distance": 2704
    },
    {
    "_from": "airports/BOS",
    "_to": "airports/SFO",
    "UniqueCarrier": "AA",
    "Distance": 2704
    },
    {
    "_from": "airports/BOS",
    "_to": "airports/SFO",
    "UniqueCarrier": "B6",
    "Distance": 2704
    },
    {
    "_from": "airports/JFK",
    "_to": "airports/SFO",
    "UniqueCarrier": "AA",
    "Distance": 2586
    },
 
Help us improve

Anything unclear or buggy in this tutorial? Provide Feedback